﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Runtime.Serialization;
using Microsoft.Practices.Prism.Mvvm;
using Interfaces;

namespace Services
{
    [DataContract]
    public class NewsResult : INotifyPropertyChanged, INewsResult
    {
        [DataMember] public DateTime DateTime { get { return _dateTime; } set { _dateTime = value; NotifyPropertyChanged("DateTime"); } }
        [DataMember] public string Title { get { return _title; } set { _title = value; NotifyPropertyChanged("Title"); } }
        [DataMember] public string Content { get { return _content; } set { _content = value; NotifyPropertyChanged("Content"); } }
        [DataMember] public string Url { get { return _url; } set { _url = value; NotifyPropertyChanged("Url"); } }
        [DataMember] public string Publisher { get { return _publisher; } set { _publisher = value; NotifyPropertyChanged("Publisher"); } }

        public event PropertyChangedEventHandler PropertyChanged;

        private string _title, _content, _url, _publisher;
        private DateTime _dateTime;

        private void NotifyPropertyChanged(string info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    }
}
